package com.mxpio.erp.common.equipment.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.mxpio.erp.common.jpa.policy.ResCodeGeneratorPolicy;
import com.mxpioframework.jpa.annotation.Generator;
import com.mxpioframework.security.annotation.Dict;
import com.mxpioframework.security.entity.BaseEntity;
import com.mxpioframework.security.entity.User;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;

/**
 * @Description: 点检任务
 * @Author: wxy
 * @Date:   2021-09-23
 * @Version: V1.0
 */
@Data
@EqualsAndHashCode(callSuper=false)
@Entity
@Table(name = "MB_ERP_EQUIPMENT_CHECK_TASK")
@Schema(description="点检任务")
public class EquipmentCheckTask extends BaseEntity {
    private static final long serialVersionUID = 1L;

	/**主键*/
    @Id
    @Generator
    @Column(name = "ID_", updatable = false)
    @Schema(description = "ID")
    private String id;


	/**工单编码*/
    @Column(name = "ORDER_CODE_",updatable = false)
    @Schema(description = "工单编码")
    @Generator(policy = ResCodeGeneratorPolicy.class)
    private String orderCode;
	/**目标类型*/

    @Dict(dicCode = "ERP_EQUIPMENT_TASK_TARGET_TYPE")
    @Column(name = "TARGET_TYPE_")
    @Schema(description = "目标类型")
    private String targetType;
	/**目标ID*/
    @Column(name = "TARGET_ID_")
    @Schema(description = "目标ID")
    private String targetId;
	/**目标名称*/
    @Column(name = "TARGET_NAME_")
    @Schema(description = "目标名称")
    private String targetName;
	/**目标编码*/
    @Column(name = "TARGET_CODE_")
    @Schema(description = "目标编码")
    private String targetCode;
	/**设备型号*/
    @Column(name = "TARGET_SPEC_")
    @Schema(description = "设备型号")
    private String targetSpec;
	/**具体位置*/
    @Column(name = "POSITION_")
    @Schema(description = "具体位置")
    private String position;
	/**工单状态*/

    @Dict(dicCode = "ERP_EQUIPMENT_CHECKTASK_STATUS")
    @Column(name = "ORDER_STATUS_")
    @Schema(description = "工单状态")
    private Integer orderStatus;
	/**生成类型*/
    @Column(name = "CREATE_TYPE_")
    @Schema(description = "生成类型")
    private String createType;
	/**计划开始时间*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @Column(name = "PLAN_START_TIME_")
    @Schema(description = "计划开始时间")
    private Date planStartTime;
	/**计划结束时间*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @Column(name = "PLAN_END_TIME_")
    @Schema(description = "计划结束时间")
    private Date planEndTime;
	/**下达目标类型*/

    @Dict(dicCode = "ERP_EQUIPMENT_RELEASE_TARGET_TYPE")
    @Column(name = "RELEASE_TARGET_TYPE_")
    @Schema(description = "下达目标类型")
    private String releaseTargetType;
	/**下达目标*/
    @Column(name = "RELEASE_TARGET_ID_")
    @Schema(description = "下达目标")
    private String releaseTargetId;
	/**下达目标*/
    @Column(name = "RELEASE_TARGET_NAME_")
    @Schema(description = "下达目标名称")
    private String releaseTargetName;
    /**是否自动下达*/
    @Dict(dicCode = "ERP_COMMON_YESNO")
    @Column(name = "IS_AUTO_RELEASE_")
    @Schema(description = "是否自动下达")
    private Integer isAutoRelease;
	/**部门/群组责任人*/
    @Column(name = "DIRECTOR_")
    @Schema(description = "部门/群组责任人")
    private String director;
	/**计划下达时间*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @Column(name = "PLAN_RELEASE_TIME_")
    @Schema(description = "计划下达时间")
    private Date planReleaseTime;
	/**派工模式*/

    @Dict(dicCode = "ERP_EQUIPMENT_DISPATCH_MODE")
    @Column(name = "DISPATCH_MODE_")
    @Schema(description = "派工模式")
    private String dispatchMode;
	/**实际开始时间*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @Column(name = "ACTUAL_START_TIME_")
    @Schema(description = "实际开始时间")
    private Date actualStartTime;
	/**实际结束时间*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @Column(name = "ACTUAL_END_TIME_")
    @Schema(description = "实际结束时间")
    private Date actualEndTime;
	/**滞后下达*/
    @Dict(dicCode = "ERP_COMMON_YESNO")
    @Column(name = "IS_LAG_")
    @Schema(description = "滞后下达")
    private Integer isLag;
	/**滞后下达时间*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @Column(name = "LAG_TIME_")
    @Schema(description = "滞后下达时间")
    private Date lagTime;
	/**执行人*/
    @Dict(dicEntity = User.class, dicText = "nickname", dicCode = "username")
    @Column(name = "CHECK_TYPE_")
    @Schema(description = "执行人")
    private String executor;
	/**设备开关机状态*/
    @Dict(dicCode = "ERP_COMMON_YESNO")
    @Column(name = "EQP_STATUS_")
    @Schema(description = "设备开关机状态")
    private String eqpStatus;
	/**下达时间*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @Column(name = "RELEASE_TIME_")
    @Schema(description = "下达时间")
    private Date releaseTime;
	/**派工时间*/
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @Column(name = "DISPATCH_TIME_")
    @Schema(description = "派工时间")
    private Date dispatchTime;
	/**派工操作人*/
    @Dict(dicEntity = User.class, dicText = "nickname", dicCode = "username")
    @Column(name = "DISPATCH_USER_")
    @Schema(description = "派工操作人")
    private String dispatchUser;

    @Column(name = "CHECK_GROUP_CODE_")
    @Schema(description = "点检群组")
    @Dict(dicCode="groupCode", dicEntity = EquipmentPersonGroup.class, dicText = "groupName")
    private String checkPersonGroupCode;

}
